package com.zyong.design.pattern.iterator.case1;

import java.util.ArrayList;
import java.util.List;

/**
 * @program: zyong-design-pattern
 * @ClassName: StudentAggregateImpl
 * @author: zyong
 * @create: 2024-06-01 08:29
 */
public class StudentAggregateImpl implements StudentAggregate {
    private List<Student> list = new ArrayList<Student>();

    @Override
    public void addStudent(Student student) {
        list.add(student);
    }

    @Override
    public void removeStudent(Student student) {
        list.remove(student);
    }

    @Override
    public StudentIterator getStudentIterator() {
        return new StudentIteratorImpl(list);
    }
}
